/* 
 * jxListFiles Project (2012, 2013, 2014)
 * 
 * by Denilson Edinaldo Pinto
 * 
 * GPL
 * Copyright (C) 2014
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */
package org.jxListFiles.view;

import javax.swing.JLabel;
import javax.swing.JProgressBar;
import javax.swing.JWindow;
import javax.swing.SwingConstants;

import java.awt.BorderLayout;
import java.awt.Font;

/**
 * @author Denilson Edinaldo Pinto
 * @porject jxListFiles
 * @package org.jxListFiles.view
 * @date 16/11/2013 - 10:24:55
 */
public class VwWait extends JWindow {
	
	private static final long serialVersionUID = 3598118541888661375L;
	
	private String message;
	
	private JLabel lblMessage;
	
	private JProgressBar progressBar;
	
	/**
	 * @param message
	 */
	public VwWait(final String message) {
	
		this.message = message;
		
		initGUI();
	}
	
	public JLabel getLblMessage() {
	
		if(lblMessage == null) {
			lblMessage = new JLabel(message);
			lblMessage.setFont(new Font("Courier New", Font.BOLD, 25));
			lblMessage.setHorizontalAlignment(SwingConstants.CENTER);
		}
		return lblMessage;
	}
	
	public JProgressBar getProgressBar() {
	
		if(progressBar == null) {
			progressBar = new JProgressBar();
			progressBar.setIndeterminate(true);
		}
		return progressBar;
	}
	
	private void initGUI() {
	
		setBounds(100, 100, 750, 200);
		getContentPane().add(getLblMessage(), BorderLayout.CENTER);
		getContentPane().add(getProgressBar(), BorderLayout.SOUTH);
		setLocationRelativeTo(null);
	}
}
